package com.itany.springboot.springboot03.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.util.StringUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    private Integer id;
    private String username;
    private String password;
    private String sex;
    private String edu;
    private String[] hobbies;
    private String description;
    private String status;

    public void setHob(String hob){
        if(hob!=null){
            hobbies=hob.split(",");
        }
    }

    public String getHob(){
        if(hobbies!=null){
            return StringUtils.arrayToDelimitedString(hobbies,",");
        }
        return null;
    }
}
